﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;

namespace Tradex.Trading {
    
    /// <summary>
    /// The OrderExecution contains information about one specific order execution.
    /// </summary>
    [Serializable()]
    public class OrderExecution {

        /// <summary>
        /// This is the constructor of the OrderExecution.
        /// </summary>
        /// <param name="timestamp"></param>
        /// <param name="type"></param>
        /// <param name="quantity"></param>
        /// <param name="price"></param>
        /// <param name="rithmicType"></param>
        /// <param name="currency"></param>
        /// <param name="settlement"></param>
        public OrderExecution (
            DateTime timestamp,
            OrderExecutionType type,
            int quantity, double price,
            string rithmicType, string currency, string settlement
        ) {
            Timestamp = timestamp;
            ExecutionType = type;
            Quantity = quantity;
            Price = price;
            RType = rithmicType;
            Currency = currency;
            Settlement = settlement;
        }

        /// <summary>
        /// This is the timestamp of the execution.
        /// </summary>
        public DateTime Timestamp { get; private set; }

        /// <summary>
        /// This is the execution type - either a fill, or a bust.
        /// </summary>
        public OrderExecutionType ExecutionType { get; private set; }

        /// <summary>
        /// This is the quantity that was purchased / sold.
        /// </summary>
        public int Quantity { get; private set; }

        /// <summary>
        /// This is the price of the execution.
        /// </summary>
        public double Price { get; private set; }

        /// <summary>
        /// The rithmic type? ;) need to kill that.
        /// </summary>
        public string RType { get; private set; }

        /// <summary>
        /// This is the currency of the execution.
        /// </summary>
        public string Currency { get; private set; }

        /// <summary>
        /// This is the settlement (?) of the execution.
        /// </summary>
        public string Settlement { get; private set; }

        /// <ínheritdoc />
        public override string ToString() {
            return String.Format(
                CultureInfo.InvariantCulture,
                "{0}: {1} @ {2} ({3} {4} {5})",
                ExecutionType, Quantity, Price, ExecutionType, Currency, Settlement
            );
        }

    }

}
